package com.yqyd.web.controller.nbot.web;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yqyd.common.annotation.Log;
import com.yqyd.common.core.controller.BaseController;
import com.yqyd.common.core.domain.AjaxResult;
import com.yqyd.common.enums.BusinessType;
import com.yqyd.nbot.domain.NbotVehicles;
import com.yqyd.nbot.service.INbotVehiclesService;
import com.yqyd.common.utils.poi.ExcelUtil;
import com.yqyd.common.core.page.TableDataInfo;

/**
 * 九号-车辆信息Controller
 * 
 * @author Dhq
 * @date 2025-08-21
 */
@RestController
@RequestMapping("/nbot/vehicles")
public class NbotVehiclesController extends BaseController
{
    @Autowired
    private INbotVehiclesService nbotVehiclesService;

    /**
     * 查询九号-车辆信息列表
     */
    @PreAuthorize("@ss.hasPermi('nbot:vehicles:list')")
    @GetMapping("/list")
    public TableDataInfo list(NbotVehicles nbotVehicles)
    {
        startPage();
        List<NbotVehicles> list = nbotVehiclesService.selectNbotVehiclesList(nbotVehicles);
        return getDataTable(list);
    }

    /**
     * 导出九号-车辆信息列表
     */
    @PreAuthorize("@ss.hasPermi('nbot:vehicles:export')")
    @Log(title = "九号-车辆信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, NbotVehicles nbotVehicles)
    {
        List<NbotVehicles> list = nbotVehiclesService.selectNbotVehiclesList(nbotVehicles);
        ExcelUtil<NbotVehicles> util = new ExcelUtil<NbotVehicles>(NbotVehicles.class);
        util.exportExcel(response, list, "九号-车辆信息数据");
    }

    /**
     * 获取九号-车辆信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('nbot:vehicles:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(nbotVehiclesService.selectNbotVehiclesById(id));
    }

    /**
     * 新增九号-车辆信息
     */
    @PreAuthorize("@ss.hasPermi('nbot:vehicles:add')")
    @Log(title = "九号-车辆信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NbotVehicles nbotVehicles)
    {
        return toAjax(nbotVehiclesService.insertNbotVehicles(nbotVehicles));
    }

    /**
     * 修改九号-车辆信息
     */
    @PreAuthorize("@ss.hasPermi('nbot:vehicles:edit')")
    @Log(title = "九号-车辆信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NbotVehicles nbotVehicles)
    {
        return toAjax(nbotVehiclesService.updateNbotVehicles(nbotVehicles));
    }

    /**
     * 删除九号-车辆信息
     */
    @PreAuthorize("@ss.hasPermi('nbot:vehicles:remove')")
    @Log(title = "九号-车辆信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(nbotVehiclesService.deleteNbotVehiclesByIds(ids));
    }
}
